/*
 * @(#)Current.java	1.0 2000/12/14
 *
 * Copyright 2000 Thomas Barnekow. All Rights Reserved.
 *
 * This software is the proprietary information of Thomas Barnekow.
 * Use is subject to license terms.
 */

package tb.jots;

/**
 * This interface corresponds to the <code>CosTransactions::Current</code> IDL interface.
 *
 * @author Thomas Barnekow
 * @version 1.0
 */
public interface Current {

  /**
   * Begin current transaction.
   *
   * @exception NoPermissionException
   * @exception SubtransactionsUnavailableException
   */
	public void begin() throws JotsException;

  /**
   * Commit current transaction. Report heuristic exceptions if
   * <code>reportHeuristics</code> flag is set.
   *
   * @exception NoPermissionException
   * @exception NoTransactionException
   * @exception TransactionRolledBackException
   * @exception HeuristicMixedException
   * @exception HeuristicHazardException
   *
   * @see Terminator#commit
   */
	public void commit(boolean reportHeuristics) throws JotsException;

  /**
   * Rollback current transaction.
   *
   * @exception NoPermissionException
   * @exception NoTransactionException
   * @exception HeuristicMixedException
   * @exception HeuristicHazardException
   *
   * @see Terminator#rollback
   */
	public void rollback() throws JotsException;

  /**
   * Set current transaction's status to {@link OTS#STATUS_MARKED_ROLLBACK}, so that it
   * can only be rolled back.
   *
   * @exception NoPermissionException
   * @exception NoTransactionException
   *
   * @see Coordinator#rollbackOnly
   */
	public void rollbackOnly() throws JotsException;

  /**
   * Get the associated {@link Control} object reference.
   */
	public Control getControl();

  /**
   * Get the status code. Possible values are defined by {@link OTS}.
   */
	public int getStatus() throws JotsException;

  public Control suspend() throws JotsException;
  public void resume(Control control) throws InvalidControlException;
}
